{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}

{% block title %}智能语音识别模型基准测试系统{% endblock %}

{% block page_content %}
<div class="page-header">
    {% if is_searched %}
    <p>{{ kw }}搜索结果共有{{ bttasks.total }}个语音识别模型的基准测试用例</p>
    <a class="btn btn-default" href="{{ url_for('.bt_task') }}">查看所有语音识别模型的基准测试用例</a>
    {% else %}
    <p>目前共有{{ bttasks.total }}个语音识别模型的基准测试用例</p>
    <a class="btn btn-default" href="{{ url_for('.release_bttask') }}">创建语音识别模型的基准测试用例</a>
    {% endif %}
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="text" id="kw-input" onkeyup="update_action(event,this.value);" value="{{ kw }}">
    <a class="btn btn-default" id="search-a" href="{{ url_for('.bt_task_search',kw='') }}">搜索</a><br>
    <p>筛选条件：</p>
    <p>测试场景：<input type="checkbox" id="train-scenario-search">训练场景&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="infer-scenario-search">推理场景&nbsp;&nbsp;&nbsp;&nbsp;<span id="open-search-span"><a style="color:blue;" href="javascript:void(0);" onclick="open_search();">展开</a></span></p>
    <p id="metrics-search-p" style="display:none;">预期采集的基准测试指标类型：<input type="checkbox" id="train-duration-search">训练时长&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="val-accuracy-search">验证准确率&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="accuracy-search">准确率&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="latency-search">延迟&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="throughput-search">吞吐量&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="gpu-utility-search">GPU利用率&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="gpu-memory-utility-search">显存利用率&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="gpu-memory-usage-search">显存使用量&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="gpu-temperature-search">GPU温度&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="gpu-power-search">GPU功率&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="gpu-clock-frequency-search">GPU时钟频率&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="cpu-utility-search">CPU利用率&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="memory-usage-search">内存使用量</p>
    <p id="model-save-type-search-p" style="display:none;">深度学习框架导出的模型文件的保存内容：<input type="checkbox" id="weights-search">权重&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="weights-structure-search">权重+结构</p>
    <p id="train-stop-criterion-search-p" style="display:none;">模型训练的结束指标：<input type="checkbox" id="delta-loss-search">损失值变化量&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="val-accuracy-train-stop-criterion-search">验证准确率&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="train-time-search">训练时间&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="iterations-search">迭代轮数</p>
    <p id="infer-stop-criterion-search-p" style="display:none;">模型推理的结束指标：<input type="checkbox" id="data-num-epoch-search">被模型处理的语音数量&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="infer-time-search">推理时间</p>
    <p id="infer-scenario-search-p" style="display:none;">推理场景的类型：<input type="checkbox" id="online-search">在线推理&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="offline-search">离线推理</p>
    <p id="client-request-distribution-search-p" style="display:none;">在线推理场景下客户端的请求发送间隔服从的分布类型：<input type="checkbox" id="uniform-search">正态分布&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="normal-search">均匀分布&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="const-search">常量&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="poisson-search">泊松分布&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="real-time-search">实时</p>
    <p id="summary-again-search-p" style="display:none;">是否重新汇总数据集中的语音文件和转录文本：<input type="checkbox" id="summary-again-search">是&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="not-summary-again-search">否</p>
    <p id="maintain-data-all-search-p" style="display:none;">是否将所有数据存储在内存中：<input type="checkbox" id="maintain-data-all-search">是&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="not-maintain-data-all-search">否&nbsp;&nbsp;&nbsp;&nbsp;<span><a id="close-search-a" style="color:blue;" href="javascript:void(0);" onclick="close_search();">闭合</a></span></p>
    {% if bttasks.first==0 %}
    <p>没有{% if kw %}含有{{ kw }}的{% endif %}语音识别模型的基准测试用例</p>
    {% else %}
    <div class="row">
    <table class="table">
        <thead>
        <tr>
            <th rowspan="2">名称</th>
            <th rowspan="2">测试场景</th>
            <th rowspan="2">计算设备id</th>
            <th rowspan="2">基准测试指标类型</th>
            <th rowspan="2">音频处理方法</th>
            <th colspan="2">模型的保存方式</th>
            <th colspan="3">训练场景下的测试停止条件</th>
            <th colspan="2">推理场景下的测试停止条件</th>
            <th colspan="4">推理场景的特征</th>
            <th rowspan="2">数据集</th>
            <th rowspan="2">是否重新生成从所有语音文件名称到转录文本的索引表</th>
            <th rowspan="2">是否将所有数据存储在内存中</th>
            <th rowspan="2">语音的前端处理器（和特征提取器）</th>
            <th rowspan="2">语音的特征提取器</th>
            <th rowspan="2">模型的训练数据预处理器</th>
            <th rowspan="2">模型的验证数据预处理器</th>
            <th rowspan="2">模型的测试数据预处理器</th>
            <th rowspan="2">模型的后处理器</th>
            <th rowspan="2">语音识别模型</th>
            <th rowspan="2">批量大小</th>
            <th rowspan="2">训练场景下采集指标数据经历的训练迭代轮数周期</th>
            <th rowspan="2">用于训练的语音文件数量</th>
            <th rowspan="2">用于验证的语音文件数量</th>
            <th rowspan="2">用于测试的语音文件数量</th>
            <th rowspan="2">状态</th>
            <th rowspan="2">保存模型文件经历的指标数据采集次数周期</th>
            <th rowspan="2">硬件开销指标数据的采集周期</th>
            <th rowspan="2">备注</th>
            <th rowspan="2">操作</th>
        </tr>
        <tr>
            <th>存储目录路径</th>
            <th>模型文件内容类型</th>
            <th>种类</th>
            <th>阈值</th>
            <th>最少满足次数</th>
            <th>种类</th>
            <th>阈值</th>
            <th>推理场景种类</th>
            <th>在线推理场景下的客户端数量</th>
            <th>在线场景下同一客户端所发送语音请求的时间间隔服从的分布类型</th>
            <th>在线场景下同一客户端所发送语音请求的时间间隔服从的分布参数</th>
        </tr>
        </thead>
        <tbody>
        {% for i in range(bttasks.items|length) %}
        <tr>
            <td class="content-td">{{ bttasks.items[i].name }}</td>
            <td>{% if bttasks.items[i].typ==0 %}训练场景{% elif bttasks.items[i].typ==1 %}推理场景{% endif %}</td>
            <td>{{ bttasks.items[i].device_id }}</td>
            <td>{{ metric_names[i] }}</td>
            <td>{{ bttasks.items[i].audio_conversion }}</td>
            <td class="content-td">{{ bttasks.items[i].model_save_dir }}</td>
            <td>{% if bttasks.items[i].model_save_style==0 %}参数{% elif bttasks.items[i].model_save_style==1 %}参数+结构{% endif %}</td>
            <td>{% if bttasks.items[i].train_stop_criterion_category==0 %}模型的损失函数值变化量{% elif bttasks.items[i].train_stop_criterion_category==1%}模型的验证准确率{% elif bttasks.items[i].train_stop_criterion_category==2%}模型的训练时长{% elif bttasks.items[i].train_stop_criterion_category==3%}模型的训练迭代轮数{% endif %}</td>
            <td>{{ bttasks.items[i].train_stop_criterion_threshold }}</td>
            <td>{{ bttasks.items[i].train_stop_criterion_times }}</td>
            <td>{% if bttasks.items[i].infer_stop_criterion_category==0 %}被模型处理的语音数量{% elif bttasks.items[i].infer_stop_criterion_category==1 %}基准测试时长{% endif %}</td>
            <td>{{ bttasks.items[i].infer_stop_criterion_threshold }}</td>
            <td>{% if bttasks.items[i].infer_scenario_category ==0 %}在线推理场景{% elif bttasks.items[i].infer_scenario_category==1 %}离线推理场景{% endif %}</td>
            <td>{{ bttasks.items[i].infer_scenario_client_num }}</td>
            <td>{% if bttasks.items[i].infer_scenario_request_interval_distribution==0 %}均匀分布{% elif bttasks.items[i].infer_scenario_request_interval_distribution==1 %}正态分布{% elif bttasks.items[i].infer_scenario_request_interval_distribution==2 %}常量{% elif bttasks.items[i].infer_scenario_request_interval_distribution==3 %}持续请求（泊松分布）{% elif bttasks.items[i].infer_scenario_request_interval_distribution==4 %}实时请求{% endif %}</td>
            <td>{{ bttasks.items[i].infer_scenario_request_interval_distribution_params }}</td>
            <td><a href="{{ url_for('.datasubsets',id=bttasks.items[i].dataset_id) }}">{{ dataset_names[i] }}</a></td>
            <td>{% if bttasks.items[i].summary_again %}是{% else %}否{% endif %}</td>
            <td>{% if bttasks.items[i].maintain_data_all %}是{% else %}否{% endif %}</td>
            <td><a href="{{ url_for('.ff',id=bttasks.items[i].fp_id) }}">{{ fp_names[i] }}</a></td>
            <td>{% if bttasks.items[i].fe_id!=-1 %}<a href="{{ url_for('.ff',id=bttasks.items[i].fe_id) }}">{{ fe_names[i] }}</a>{% endif %}</td>
            <td><a href="{{ url_for('.dp',id=bttasks.items[i].train_data_preprocessor_id) }}">{{ train_data_preprocessor_names[i] }}</a></td>
            <td><a href="{{ url_for('.dp',id=bttasks.items[i].val_data_preprocessor_id) }}">{{ val_data_preprocessor_names[i] }}</a></td>
            <td><a href="{{ url_for('.dp',id=bttasks.items[i].test_data_preprocessor_id) }}">{{ test_data_preprocessor_names[i] }}</a></td>
            <td><a href="{{ url_for('.pp',id=bttasks.items[i].post_processor_id) }}">{{ post_processor_names[i] }}</a></td>
            <td><a href="{{ url_for('.m',id=bttasks.items[i].model_id) }}">{{ model_names[i] }}</a></td>
            <td>{{ bttasks.items[i].batch_size }}</td>
            <td>{{ bttasks.items[i].checkpoint_iters }}</td>
            <td>{{ bttasks.items[i].train_data_num }}</td>
            <td>{{ bttasks.items[i].val_data_num }}</td>
            <td>{{ bttasks.items[i].test_data_num }}</td>
            <td>{% if bttasks.items[i].status==0 %}发布中{% elif bttasks.items[i].status==1 %}待执行{% elif bttasks.items[i].status==2 %}更新中{% elif bttasks.items[i].status==3 %}暂停中{% elif bttasks.items[i].status==4 %}已完成{% elif bttasks.items[i].status==5 %}被舍弃{% elif bttasks.items[i].status==6 %}执行中{% elif bttasks.items[i].status==7 %}执行出现错误{% elif bttasks.items[i].status==8 %}已提交{% elif bttasks.items[i].status==9 %}正在中止{% elif bttasks.items[i].status==10 %}正在取消{% endif %}</td>
            <td>{{ bttasks.items[i].save_ckpt_interval }}</td>
            <td>{{ bttasks.items[i].hardware_cost_collection_interval }}</td>
            <td class="content-td">{{ bttasks.items[i].note }}</td>
            <td>
                <a class="btn btn-default" href="{{ url_for('.bttask_delete',id=bttasks.items[i].id,page=page,per_page=per_page) }}">删除</a>
                <a class="btn btn-default" href="{{ url_for('.btt',id=bttasks.items[i].id) }}">查看基准测试用例详情</a>
                <a class="btn btn-default" href="{{ url_for('.bttask_json',id=bttasks.items[i].id) }}">导出语音识别模型的基准测试用例的json配置文件</a>
                <a class="btn btn-default" href="{{ url_for('.bttask_active',id=bttasks.items[i].id) }}">更新活动时间</a>
                <a class="btn btn-default" href="{{ url_for('.bttask_copy',id=bttasks.items[i].id) }}">以此为模版新建</a>
                <a class="btn btn-default" href="{{ url_for('.set_bttask_status',id=bttasks.items[i].id,status=1,exec_id=-1,btexec_id=-1) }}">开始执行基准测试任务</a>
                <a class="btn btn-default" href="{{ url_for('.add_bttask_s_tp',bttask_id=bttasks.items[i].id) }}">将此测试用例添加到测试项目中</a>
            </td>
        </tr>
        {% endfor %}
        </tbody>
        <tfoot>
            {% if is_searched %}
            <tr>
                <td colspan="18">
                    <ul class="pagination">
                        {% for i in page_range %}
                        {% if i==bttasks.page %}
                        <li class="active"><a href="/bt_task_search?page={{ i }}&per_page={{ per_page }}&{{ params }}">{{ i }}</a></li>
                        {% else %}
                        <li><a href="/bt_task_search?page={{ i }}&per_page={{ per_page }}&{{ params }}">{{ i }}</a></li>
                        {% endif %}
                        {% endfor %}
                    </ul>
                </td>
                <td colspan="18" style="vertical-align:bottom">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">当前每页{{ per_page }}条数据项，更改至每页数据项 <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            {% for i in [5,10,20,50] %}
                            <li><a href="/bt_task_search?page=1&per_page={{ i }}&{{ params }}">{{ i }}条</a></li>
                            {% endfor %}
                        </ul>
                    </li>
                </td>
            </tr>
            {% else %}
            <tr>
                <td colspan="18">
                    <ul class="pagination">
                        {% for i in page_range %}
                        {% if i==bttasks.page %}
                        <li class="active"><a href="/bt_task?page={{ i }}&per_page={{ per_page }}">{{ i }}</a></li>
                        {% else %}
                        <li><a href="/bt_task?page={{ i }}&per_page={{ per_page }}">{{ i }}</a></li>
                        {% endif %}
                        {% endfor %}
                    </ul>
                </td>
                <td colspan="18" style="vertical-align:bottom">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">当前每页{{ per_page }}条数据项，更改至每页数据项 <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            {% for i in [5,10,20,50] %}
                            <li><a href="/bt_task?page=1&per_page={{ i }}">{{ i }}条</a></li>
                            {% endfor %}
                        </ul>
                    </li>
                </td>
            </tr>
            {% endif %}
        </tfoot>
    </table>
</div>
    {% endif %}
    <p id="kw-value" style="display:none">{{ kw }}</p>
<script type="text/javascript">
    function update_action(event,s){
        if(s.length!=0){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace(new RegExp('\\?kw\\=[^&]*','gi'),'?kw='+s));
            if(event.key=='Enter'){
                window.location.href=$('#search-a').attr('href');
            }
        }
    }

    function open_search(){
        $('#metrics-search-p').attr('style','display:block;');
        $('#model-save-type-search-p').attr('style','display:block;');
        $('#train-stop-criterion-search-p').attr('style','display:block;');
        $('#infer-stop-criterion-search-p').attr('style','display:block;');
        $('#infer-scenario-search-p').attr('style','display:block;');
        $('#client-request-distribution-search-p').attr('style','display:block;');
        $('#summary-again-search-p').attr('style','display:block;');
        $('#maintain-data-all-search-p').attr('style','display:block;');
        $('#open-search-span').attr('style','display:none;');
    }

    function close_search(){
        $('#metrics-search-p').attr('style','display:none;');
        $('#model-save-type-search-p').attr('style','display:none;');
        $('#train-stop-criterion-search-p').attr('style','display:none;');
        $('#infer-stop-criterion-search-p').attr('style','display:none;');
        $('#infer-scenario-search-p').attr('style','display:none;');
        $('#client-request-distribution-search-p').attr('style','display:none;');
        $('#summary-again-search-p').attr('style','display:none;');
        $('#maintain-data-all-search-p').attr('style','display:none;');
        $('#open-search-span').attr('style','display:inline;');
    }

    $('#train-scenario-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&train_scenario=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&train_scenario=1',''));
        }
    })

    $('#infer-scenario-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&infer_scenario=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&infer_scenario=1',''));
        }
    })

    $('#train-duration-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&train_duration=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&train_duration=1',''));
        }
    })
    
    $('#val-accuracy-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&val_accuracy=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&val_accuracy=1',''));
        }
    })

    $('#accuracy-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&accuracy=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&accuracy=1',''));
        }
    })

    $('#latency-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&latency=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&latency=1',''));
        }
    })

    $('#throughput-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&throughput=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&throughput=1',''));
        }
    })

    $('#gpu-utility-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&gpu_utility=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&gpu_utility=1',''));
        }
    })

    $('#gpu-memory-utility-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&gpu_memory_utility=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&gpu_memory_utility=1',''));
        }
    })

    $('#gpu-memory-usage-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&gpu_memory_usage=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&gpu_memory_usage=1',''));
        }
    })

    $('#gpu-temperature-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&gpu_temperature=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&gpu_temperature=1',''));
        }
    })

    $('#gpu-power-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&gpu_power=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&gpu_power=1',''));
        }
    })

    $('#gpu-clock-frequency-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&gpu_clock_frequency=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&gpu_clock_frequency=1',''));
        }
    })

    $('#cpu-utility-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&cpu_utility=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&cpu_utility=1',''));
        }
    })

    $('#memory-usage-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&memory_usage=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&memory_usage=1',''));
        }
    })

    $('#weights-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&weights=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&weights=1',''));
        }
    })

    $('#weights-structure-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&weights_structure=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&weights_structure=1',''));
        }
    })

    $('#delta-loss-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&delta_loss=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&delta_loss=1',''));
        }
    })

    $('#val-accuracy-train-stop-criterion-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&val_accuracy_train_stop_criterion=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&val_accuracy_train_stop_criterion=1',''));
        }
    })

    $('#train-time-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&train_time=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&train_time=1',''));
        }
    })

    $('#iterations-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&iterations=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&iterations=1',''));
        }
    })

    $('#data-num-epoch-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&data_num_epoch=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&data_num_epoch=1',''));
        }
    })

    $('#infer-time-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&infer_time=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&infer_time=1',''));
        }
    })

    $('#online-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&online=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&online=1',''));
        }
    })

    $('#offline-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&offline=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&offline=1',''));
        }
    })

    $('#uniform-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&uniform=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&uniform=1',''));
        }
    })

    $('#normal-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&normal=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&normal=1',''));
        }
    })

    $('#const-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&const=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&const=1',''));
        }
    })

    $('#poisson-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&poisson=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&poisson=1',''));
        }
    })

    $('#real-time-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&real_time=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&real_time=1',''));
        }
    })

    $('#summary-again-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&summary_again=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&summary_again=1',''));
        }
    })

    $('#not-summary-again-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&not_summary_again=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&not_summary_again=1',''));
        }
    })

    $('#maintain-data-all-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&maintain_data_all=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&maintain_data_all=1',''));
        }
    })

    $('#not-maintain-data-all-search').change(function(){
        if(this.checked==true){
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href+'&not_maintain_data_all=1');
        }else{
            old_href=$('#search-a').attr('href');
            $('#search-a').attr('href',old_href.replace('&not_maintain_data_all=1',''));
        }
    })
</script>
{% if is_searched and kw %}
<script type="text/javascript">
    $(document).ready(function(){
        var query=$('#kw-value').text();
        var content_tds=document.getElementsByClassName('content-td');
        var regex=new RegExp(query,'gi');
        for(let i=0;i<content_tds.length;i++){
            content_tds[i].innerHTML=content_tds[i].innerHTML.replace(regex,'<font style="color:red;">$&</font>');
        }
    });
</script>
{% endif %}
{% if is_searched %}
<script type="text/javascript">
    $(document).ready(function(){
    var url=window.location.href;
    // 设置search-a.href为url
    $('#search-a').attr('href',url.replace(new RegExp('&page=[^&]*','gi'),'').replace(new RegExp('&per_page=[^&]*','gi'),''));
    // 选中要搜索的多选框
    var checkbox_kws=url.substring(url.indexOf('&')).split('=1');
    for(let i=0;i<checkbox_kws.length-1;i++){
        switch(checkbox_kws[i].substring(1)){
            case 'train_scenario':
                $('#train-scenario-search').attr('checked','checked');
                break;
            case 'infer_scenario':
                $('#infer-scenario-search').attr('checked','checked');
                break;
            case 'train_duration':
                $('#train-duration-search').attr('checked','checked');
                break;
            case 'val_accuracy':
                $('#val-accuracy-search').attr('checked','checked');
                break;
            case 'accuracy':
                $('#accuracy-search').attr('checked','checked');
                break;
            case 'latency':
                $('#latency-search').attr('checked','checked');
                break;
            case 'throughput':
                $('#throughput-search').attr('checked','checked');
                break;
            case 'gpu_utility':
                $('#gpu-utility-search').attr('checked','checked');
                break;
            case 'gpu_memory_utility':
                $('#gpu-memory-utility-search').attr('checked','checked');
                break;
            case 'gpu_memory_usage':
                $('#gpu-memory-usage-search').attr('checked','checked');
                break;
            case 'gpu_temperature':
                $('#gpu-temperature-search').attr('checked','checked');
                break;
            case 'gpu_power':
                $('#gpu-power-search').attr('checked','checked');
                break;
            case 'gpu_clock_frequency':
                $('#gpu-clock-frequency-search').attr('checked','checked');
                break;
            case 'cpu_utility':
                $('#cpu-utility-search').attr('checked','checked');
                break;
            case 'memory_usage':
                $('#memory-usage-search').attr('checked','checked');
                break;
            case 'weights':
                $('#weights-search').attr('checked','checked');
                break;
            case 'weights_structure':
                $('#weights-structure-search').attr('checked','checked');
                break;
            case 'delta_loss':
                $('#delta-loss-search').attr('checked','checked');
                break;
            case 'val_accuracy_train_stop_criterion':
                $('#val-accuracy-train-stop-criterion-search').attr('checked','checked');
                break;
            case 'train_time':
                $('#train-time-search').attr('checked','checked');
                break;
            case 'iterations':
                $('#iterations-search').attr('checked','checked');
                break;
            case 'data_num_epoch':
                $('#data-num-epoch-search').attr('checked','checked');
                break;
            case 'infer_time':
                $('#infer-time-search').attr('checked','checked');
                break;
            case 'online':
                $('#online-search').attr('checked','checked');
                break;
            case 'offline':
                $('#offline-search').attr('checked','checked');
                break;
            case 'uniform':
                $('#uniform-search').attr('checked','checked');
                break;
            case 'normal':
                $('#normal-search').attr('checked','checked');
                break;
            case 'const':
                $('#const-search').attr('checked','checked');
                break;
            case 'poisson':
                $('#poisson-search').attr('checked','checked');
                break;
            case 'real_time':
                $('#real-time-search').attr('checked','checked');
                break;
            case 'summary_again':
                $('#summary-again-search').attr('checked','checked');
                break;
            case 'not_summary_again':
                $('#not-summary-again-search').attr('checked','checked');
                break;
            case 'maintain_data_all':
                $('#maintain-data-all-search').attr('checked','checked');
                break;
            case 'not_maintain_data_all':
                $('#not-maintain-data-all-search').attr('checked','checked');
                break;
            default:
                ;
        }
    }
});
</script>
{% endif %}
</div>
{% endblock %}